<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: content_preview.php 28 2013-09-21 11:54:11Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 28 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-21 11:54:11 +0000 (Sat, 21 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

   
require('includes/application_top.php');


if ($_GET['pID']=='media') {
	$content_data = $db->db_query("	SELECT
										content_file,
										content_name,
										file_comment
									FROM 
										".TABLE_PRODUCTS_CONTENT."
									WHERE 
										content_id='".(int)$_GET['coID']."'");
} else {
	$content_data = $db->db_query("	SELECT
										content_title,
										content_heading,
										content_text,
										content_file
									FROM 
										".TABLE_CONTENT_MANAGER."
									WHERE 
										content_id='".(int)$_GET['coID']."'");
 }
?>

<html <?php echo HTML_PARAMS; ?>>
	<head>
		<title><?php echo $page_title; ?></title>
		<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
	</head>
	<body>
		<div class="pageHeading"><?php echo $content_data->fields['content_heading']; ?></div><br>
		<table border="0" width="100%" cellspacing="0" cellpadding="2">
			<tr>
				<td class="main">
					<?php
					if ($content_data->fields['content_file']!=''){
						if (strpos($content_data->fields['content_file'],'.txt')) 
							echo '<pre>';
						if ($_GET['pID']=='media') {
							// display image
							if (preg_match('/.gif/i',$content_data->fields['content_file']) || preg_match('/.jpg/i',$content_data->fields['content_file']) ||  preg_match('/.png/i',$content_data->fields['content_file']) ||  preg_match('/.tif/i',$content_data->fields['content_file']) ||  preg_match('/.bmp/i',$content_data->fields['content_file'])) {	
								echo image(DIR_WS_CATALOG.'media/products/'.$content_data->fields['content_file']);
							} else {
								include(DIR_FS_CATALOG.'media/products/'.$content_data->fields['content_file']);	
							}
						} else {
							include(DIR_FS_CATALOG.'media/content/'.$content_data->fields['content_file']);	
						}
						if (strpos($content_data->fields['content_file'],'.txt')) 
							echo '</pre>';
					} else {	      
						echo $content_data->fields['content_text'];
					}
					?>
				</td>
			</tr>
		</table>
	</body>
</html>